Adds a broker endpoint to validate query parsing without further validation/execution #17618
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses #17615 , adding a broker API endpoint that parses a query string only for syntactic validation without further processing
Testing
Tested the endpoint by running valid/invalid queries
Valid query:
curl -X POST "localhost:8000/query/sql/validateSyntax" \ -H "Content-Type: application/json" \ -d '{"sql": "SELECT * FROM meetupRsvp LIMIT 10"}'Result:
{"errorCode":null,"validQuery":true,"errorMessage":null}Valid query (non existent table):
curl -X POST "localhost:8000/query/sql/validateSyntax" \ -H "Content-Type: application/json" \ -d '{"sql": "SELECT * FROM xyz LIMIT 10"}'Result:
{"errorCode":null,"validQuery":true,"errorMessage":null}Invalid query (reserved keyword):
curl -X POST "localhost:8000/query/sql/validateSyntax" \ -H "Content-Type: application/json" \ -d '{ "sql": "SELECT select FROM airlineStats a JOIN airports b ON a.destAirportCode = b.airportCode" }'Result:
{"errorCode":"SQL_PARSING","validQuery":false,"errorMessage":"Caught exception while parsing query: SELECT select FROM airlineStats a JOIN airports b ON a.destAirportCode = b.airportCode: Encountered \"\" at line 1, column 8.\nWas expecting one of:\n "}